import {  reactive,effect } from './reactivity.js';

const state = reactive({ count: 0 });

const render = () => {
	// 访问响应式数据 `state.count`，确保 `effect` 依赖于它
	console.log(`count is: ${state.count+state.count}`);
};

effect(() => {
	// `effect` 使 `render` 变成响应式函数
	// 当 `state.count` 变化时，会自动重新执行 `render`
	render();
});

state.count = 5; // 触发 effect，打印 "count is: 5"
state.count = 6; // 触发 effect，打印 "count is: 6"
